﻿using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Windows;
using System.Diagnostics;

namespace DiagnosticAndMonitorinApp
{
    /// <summary>
    /// Lógica de interacción para App.xaml
    /// </summary>
    public partial class App : Application
    {


        private void Application_DispatcherUnhandledException(object sender, System.Windows.Threading.DispatcherUnhandledExceptionEventArgs e)
        {

            if (!EventLog.SourceExists("DiagnosticAndMonitoringApp"))
            {
                EventLog.CreateEventSource("DiagnosticAndMonitoringApp", "MyLog");
            }

            // Create an EventLog instance and assign its source.
            EventLog myLog = new EventLog();

            myLog.Source = "DiagnosticAndMonitoringApp";

            // Write an informational entry to the event log.    
            myLog.WriteEntry("Usando Event Log### Application_DispatcherUnhandledException!!!");

            MessageBox.Show("La aplicación a prensentado un problema, debe cerrarse");

        }
    }
}
